#ifndef _CRT_AES_h
#define _CRT_AES_h

#include <crt_core.hpp>

#ifdef __cplusplus
extern "C" {
#endif

#define aes_size_t     unsigned int
#define aes_byte_t     unsigned char
#define aes_maxnr      14
#define aes_block_size 16
#define aes_e_len      256
#define aes_d_len      256

typedef unsigned int aes_u32;
typedef unsigned short aes_u16;
typedef unsigned char aes_u8;

typedef struct aes_ctx_s aes_ctx_t;

struct aes_ctx_s {
    unsigned int rd_key[4 * (aes_maxnr + 1)];
    int rounds;
};

int _aes_set_encrypt_key(const aes_byte_t* userKey, const aes_size_t bits, aes_ctx_t* key);
int _aes_set_decrypt_key(const aes_byte_t* userKey, const aes_size_t bits, aes_ctx_t* key);

// len => 16 error
int _aes_encrypt(const aes_byte_t* in, aes_byte_t* out, const aes_ctx_t* key);
int _aes_decrypt(const aes_byte_t* in, aes_byte_t* out, const aes_ctx_t* key);

#ifdef __cplusplus
}
#endif

#endif
